/**
 * 
 */
package cen5501c.common;

import java.util.ArrayList;
import java.util.List;

/**
 * GETDELAY.
 * 
 * Requests the server to echo back for the purpose of delay measurement. An
 * integer code follows the command. The server uses the code to randomize the
 * server delay. It is a trick for the server to generate different processing
 * times. The server will reply with the DELAY protocol command.
 * 
 * Example: <GETDELAY,8347>\n
 * 
 * @author Jiangyan Xu
 * 
 */
public class GetDelayCmd extends CmdBase {

	public static final String OPERATION = "GETDELAY";
	private int code;

	public GetDelayCmd() {
	}

	/**
	 * @param args
	 * @throws Exception
	 */
	public GetDelayCmd(List<String> args) throws Exception {
		super(args);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cen5501c.common.CmdBase#fillArgs(java.util.List)
	 */
	@Override
	protected void fillArgs(List<String> args) {
		code = Integer.parseInt(args.get(0));
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cen5501c.common.CmdBase#getArgList()
	 */
	@Override
	public List<String> getArgList() {
		List<String> ret = new ArrayList<String>();
		ret.add(Integer.toString(code));
		return ret;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cen5501c.common.CmdBase#getOperation()
	 */
	@Override
	public String getOperation() {
		return OPERATION;
	}

	/**
	 * @return the code
	 */
	public int getCode() {
		return code;
	}

	/**
	 * @param code
	 *            the code to set
	 */
	public void setCode(int code) {
		this.code = code;
	}

}
